/* eslint-disable strict */
'use strict'

const WebSocketServer = require('ws').Server
    , wss = new WebSocketServer({ port: 8090 })



wss.on('connection', function (ws) {

    console.log('connected.')
    wss.clients.forEach((client) => {
        client.send('connected.')
    })

    ws.on('message', function (message) {
        console.log('received: %s', message)
        wss.clients.forEach((client) => {
            client.send('data:' + message)
        })
    })
})